

@deprecated
class FFTimeUtil {
  /**
   * 当前时间戳 毫秒
   */
  static int currentTimeMillis() {
    int value = new DateTime.now().millisecondsSinceEpoch;
    return value;
  }

  /**
   * 年/月/日 时:分
   * stamp 秒
   */
  static String timeStampToTimeString(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${date.year}/${date.month}/${date.day} ${date.hour}:${date.minute}";
  }

  /**
   * 年-月-日 时:分:秒
   * stamp 秒
   */
  static String timeStampToTimeString1(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.year}")}-${twoChar("${date.month}")}-${twoChar("${date.day}")} ${twoChar("${date.hour}")}:${twoChar("${date.minute}")}:${twoChar("${date.second}")}";
  }

  /**
   * 年-月-日 时:分
   * stamp 秒
   */
  static String timeStampToTimeString2(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.year}")}-${twoChar("${date.month}")}-${twoChar("${date.day}")} ${twoChar("${date.hour}")}:${twoChar("${date.minute}")}";
  }

  /**
   * 时:分
   * stamp 秒
   */
  static String timeStampToTimeString3(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.hour}")}:${twoChar("${date.minute}")}";
  }

  /**
   * 时
   * stamp 秒
   */
  static String timeStampToTimeString_onlyHH(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    return "${twoChar("${date.hour}")}";
  }

  /**
   * 时:分:秒
   * stamp 秒
   */
  static String timeStampToTimeString4(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.hour}")}:${twoChar("${date.minute}")}:${twoChar("${date.minute}")}";
  }

  /**
   * 年-月-日
   */
  static String timeStampToTimeStringYMD(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${date.year}-${date.month}-${date.day}";
  }

  /**
   * 年.月.日
   */
  static String timeStampToTimeStringYMDDot(int stamp) {
    if (stamp == null) {
      return "";
    }
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.year}")}.${twoChar("${date.month}")}.${twoChar("${date.day}")}";
  }

  /**
   * 年/月/日
   */
  static String timeStampToTimeStringYMDSlash(int stamp) {
    if (stamp == null) {
      return "";
    }
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${twoChar("${date.year}")}/${twoChar("${date.month}")}/${twoChar("${date.day}")}";
  }

  /**
   * 年月日
   */
  static String timeStampToTimeStringYMD3(int stamp) {
    if (stamp == null) return "";
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${date.year}年${date.month}月${date.day}日";
  }

  /**
   * 月-日
   * stamp 秒
   */
  static String timeStampToTimeString_1(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    return "${date.month}-${date.day}";
  }

  /**
   * 11月30日
   * stamp 秒
   */
  static String timeStampToTimeString_3(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    // debugPrint("${date.year},${date.month},${date.day},${date.hour},${date.minute}");
    return "${date.month}月${date.day}日";
  }

  // /**
  //  * 周几
  //  * stamp 秒
  //  */
  // static String timeStampToTimeString_2(int stamp) {
  //   DateTime date = DateTime.fromMicrosecondsSinceEpoch(stamp * 1000);
  //   return DateFormat('EEE', "zh_CN").format(date);
  // }

  static String twoChar(String value) {
    if (value.length < 2) {
      return "0$value";
    }
    return value;
  }


  static DateTime timeStampToDateTime(int stamp) {
    DateTime date = DateTime.fromMillisecondsSinceEpoch(stamp * 1000);
    return date;
  }


}
